<template>
<div class="center">
    <h2>{{ message }}</h2>
</div>
</template>
<script>
import eventBus from './utils/event-bus.js'
export default {
    data() {
        return {
            message:"我是center"
        }
    },
    methods: {
        deletecenter() {
            console.log("在center中监听了")
        }
    },
    // 接收HomeNav事件
    created(){
        eventBus.on("eventemit",this.deletecenter)
    },
    // 组件被移除 销毁传来的事件总线
    unmounted() {
        console.log("center被移除")
        eventBus.off("eventemit",this.deletecenter)
    }

}
</script>
<style scoped lang="less">

</style>